<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js"></script>
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <h1>vm实例的模板</h1>
      <hr />
      <App />
    </div>
  </body>
  <script>
    Vue.config.productionTip = false; //阻止 vue 在启动时生成生产提示

    //1.创建一个App组件(组件名首字母大写)
    const App = Vue.extend({
        name: "App",
        data() {
          return {
            count: 0,
          };
        },
        template: `<div>APP组件<span>{{count}}</span></div>`,
      });

    const vm = new Vue({
      el: "#app",
      data() {
        return {};
      },
      components: {
        App,
      },
    });
  </script>
</html>
